<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "crm_mall_product_specify".
 *
 * @property int $id
 * @property int $product_id 商品外键id
 * @property string $ggmc 规格名称
 *
 * @property CrmMallProduct $product
 */
class CrmMallProductSpecify extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'crm_mall_product_specify';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['product_id'], 'integer'],
            [['ggmc'], 'string', 'max' => 30],
            [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => CrmMallProduct::className(), 'targetAttribute' => ['product_id' => 'id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'product_id' => '商品外键id',
            'ggmc' => '规格名称',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getProduct()
    {
        return $this->hasOne(CrmMallProduct::className(), ['id' => 'product_id']);
    }
}
